/*
 * @Author: 袁三金
 * @Date: 2023-10-13 10:52:07
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2023-10-21 22:10:24
 * @Description:这里书写属性相关的接口 
 */
import request  from "@/util/request";
// 属性管理模块接口地址
import type { CategoryrResponseData ,AttrResponseData,Attr} from "./type";
enum API {
    // 获取一级分类的接口方法
    C1_URL = '/admin/product/getCategory1',
    C2_URL = '/admin/product/getCategory2/',
    C3_URL = '/admin/product/getCategory3/',
    AttrValueList_URL = '/admin/product/attrInfoList/',
    ADDORUPDATE_URL = '/admin/product/saveAttrInfo',
    DELETE_URL = '/admin/product/deleteAttr/'
}
// 获取一级分类的接口
export const reqC1 = ()=> request.get<any,CategoryrResponseData>(API.C1_URL);
// 获取二级分类的接口
export const reqC2 = (id:number|string)=> request.get<any,CategoryrResponseData>(API.C2_URL+id);
// 获取三级分类的接口
export const reqC3 = (id:number|string)=> request.get<any,CategoryrResponseData>(API.C3_URL+id);
// 获取已有属性数据接口
export const reqAttrList = (id1:number|string,id2:number|string,id3:number|string)=>request.get<any,AttrResponseData>(API.AttrValueList_URL+`${id1}/${id2}/${id3}`)
// 修改或添加属性接口方法
export const AddOrUpdateAttr = (data:Attr)=>request.post<any,any>(API.ADDORUPDATE_URL,data);
// 删除属性接口
export const DeleteAttr = (id:number)=>request.delete<any,any>(API.DELETE_URL+id);